#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
    sf::RenderWindow window(sf::VideoMode(AGE_MAX*BAR_WIDTH, BAR_H_MAX), "SFML works!");
    sf::Text text("Hello SFML");

    //demograph_list dm;
    demoslice dm;
    dm.init();
    dm.init_bars();
    sf::RectangleShape r(Vector2f(3,3));
    r.setPosition(1,1);
    r.setFillColor(sf::Color::Yellow);
    
    sf::Clock clock;
    while (window.isOpen() && dm.run_sim)
    {
        sf::Event event;
        while (window.pollEvent(event))
            if (event.type == sf::Event::Closed || event.type==sf::Event::KeyPressed)
                window.close();
        if(clock.getElapsedTime().asSeconds() < DELAY)
            continue;
        clock.restart();

        dm.step();
        dm.update_bars();

        window.clear();

        FOR(AGE_MAX)
            window.draw(dm.bars[i]);
        window.draw(dm.text);
        window.display();
    }

    //system("PAUSE");
    return 0;
}
